package zhoug.demo.player;

import android.Manifest;
import android.os.Bundle;
import android.widget.Button;

import zhoug.common.permission.ZPermissions;


public class MainActivity extends MyBaseActivity {

    private Button mBtnExo;
    private Button mBtnHik;
    private Button mBtnTx;
    private Button mBtnVlc;
    private Button mBtnQly;

    @Override
    protected int getLayoutResId() {
        return R.layout.activity_main;
    }

    @Override
    protected void findViews() {
//        QlyOpenSdkPlayer
        mBtnExo = findViewById(R.id.btn_exo);
        mBtnHik = findViewById(R.id.btn_hik);
        mBtnTx = findViewById(R.id.btn_tx);
        mBtnVlc = findViewById(R.id.btn_vlc);
        mBtnQly = findViewById(R.id.btn_qly);
    }

    @Override
    protected void onCreate1(Bundle savedInstanceState) {
        mBtnExo.setOnClickListener(v->toPlayerActivity(PlayerType.EXO));
        mBtnHik.setOnClickListener(v->toPlayerActivity(PlayerType.HIK));
        mBtnTx.setOnClickListener(v->toPlayerActivity(PlayerType.TX));
        mBtnVlc.setOnClickListener(v->toPlayerActivity(PlayerType.VLC));
        mBtnQly.setOnClickListener(v->toPlayerActivity(PlayerType.QLY));

        ZPermissions.with(this)
                .setPermissions(Manifest.permission.READ_EXTERNAL_STORAGE,Manifest.permission.WRITE_EXTERNAL_STORAGE)
                .setDescription("获取本地视频需要存储权限")
                .setCallback((success, granted, denied) -> {

                })
                .request();
    }

    private void toPlayerActivity(int playerType) {
        Bundle args = new Bundle();
        args.putInt(PlayerActivity.PARAM_PLAYER_TYPE, playerType);
        toActivity(PlayerActivity.class, args);
    }


}